<?php
    function get_user_urls($username) {
        //extact from the database all the URLs this user has a stored

        $conn = $db_connect();
        $result = $conn->query("select bm_URL from bookmark where username = '".$username."'");

        if(!$result) {
            return false;
        }

        //create an array of the URLs
        $url_array = array();
        for($count=1;$row=$result->fetch_row();++$count) {
            $url_array[$count]=$row[0];
        }
        return $url_array;
    }

    function delete_bm($user,$url) {
        //delete one URL from the database
        $conn = $db_connect();

        //delete the bookmark
        if(!$conn->query("delete from bookmark where username='".$user."'and bm_url='".$url."'")) {
            throw new Exception('Bookmark could not be deleted');
        }
        return true;
    }
?>